﻿using System.Windows.Forms;

namespace Crystal.CustomControls
{
    public partial class CrystalPanel : Panel
    {
        public CrystalPanel()
        {
            Layout += CrystalPanel_InitializeLayout;
        }

        private void CrystalPanel_InitializeLayout(object sender, System.Windows.Forms.LayoutEventArgs e)
        {
            int[] Values = new int[3];
            if (CommonCustomControls.IsValidString(StyleManager.GetStyle("PanelBoxBackColor"), ref Values))
            {
                e.AffectedControl.BackColor = System.Drawing.Color.FromArgb(Values[0], Values[1], Values[2]);
            }

            if (CommonCustomControls.IsValidString(StyleManager.GetStyle("PanelBoxForeColor"), ref Values))
            {
                e.AffectedControl.ForeColor = System.Drawing.Color.FromArgb(Values[0], Values[1], Values[2]);
            }
        }
    }
}
